<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<%@ include file="../top.jsp"%>
<%@ include file="../nav.jsp"%>
</head>

<body>
 <div style="width:95%;margin:2em auto;">
	<table id="table_report" class="table table-striped table-bordered table-hover">
		<tr>
			<th class="center">
				<label><input type="checkbox" id="zcheckbox" /><span class="lbl"></span></label>
			</th>
			<th class="center">id号</th>
			<th class="center">时间</th>
			<th class="center">状态</th>
			<th class="center">温度</th>
			<th class="center">气压</th>
			<th class="center">距离</th>
			<th class="center">加速度x轴</th>
			<th class="center">加速度y轴</th>
			<th class="center">加速度z轴</th>
			<th class="center">角速度x轴</th>
			<th class="center">角速度y轴</th>
			<th class="center">角速度z轴</th>
			<th class="center">火焰</th>
			<th class="center">湿度</th>
			<th class="center">烟雾</th>
			<th class="center">实时照片</th>
			<th class="center">经度</th>
			<th class="center">纬度</th>
			<th class="center">高度</th>
			<th class="center">红外</th>
			<th class="center">紫外</th>
			<th class="center">电量</th>
			<th class="center">信号</th>
			<th class="center">操作</th>
			
		</tr>
		<!-- 开始循环 -->
		<c:choose>
			<c:when test="${not empty varList}">
				<c:forEach items="${varList}" var="var" varStatus="vs">
					<tr>
						<td class='center' style="width: 30px;"><label><input
								type='checkbox' name='ids' value="${var.eid}" /><span
								class="lbl"></span> </label>
						</td>
						<td>${var.eid}</td>
						<td>${var.time}</td>
						<td>${var.status}</td>
						<td>${var.temperature}</td>
						<td>${var.air_pressure}</td>
						<td>${var.ultrasonic_length}</td>
						<td>${var.g_x}</td>
						<td>${var.g_y}</td>
						<td>${var.g_z}</td>
						<td>${var.j_x}</td>
						<td>${var.j_y}</td>
						<td>${var.j_z}</td>
						<td>${var.fire}</td>
						<td>${var.humidity}</td>
						<td>${var.smog}</td>
						<td>${var.photo}</td>
						<td>${var.longitude}</td>
						<td>${var.latitude}</td>
						<td>${var.height}</td>
						<td>${var.infrared_ray}</td>
						<td>${var.ultraviolet_ray}</td>
						<td>${var.electricity}</td>
						<td>${var.signals}</td>
						<td style="width: 80px;">
						   <div class='hidden-phone visible-desktop btn-group'>
						       <a class='btn btn-mini btn-info' title="编辑" onclick="edit('${var.eid}');"><i class='icon-edit'></i></a>
						       
						       <a class='btn btn-mini btn-danger' title="删除" onclick="del('${var.eid}');"><i class='icon-trash'></i></a>
						      
						      
						   </div>
						</td>
						
						      
						      
						  
						
					</tr>
				</c:forEach>
			</c:when>
		</c:choose>
	</table>
</div>

</body>
	<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
	<script src="static/js/bootstrap.min.js"></script>
	<script src="static/js/ace-elements.min.js"></script>
	<script src="static/js/ace.min.js"></script>
	
   <script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->
	<script type="text/javascript">
	//新增
	function add(){
		 var diag = new top.Dialog();
		 diag.Drag=true;
		 diag.Title ="新增";
		 diag.URL = '<%=basePath%>status/goAdd.do';
		 diag.Width = 800;
		 diag.Height = 500;
		 diag.CancelEvent = function(){ //关闭事件
			 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
				 if('${page.currentPage}' == '0'){
					 top.jzts();
					 setTimeout("self.location=self.location",100);
				 }else{
					 nextPage(${page.currentPage});
				 }
			}
			diag.close();
		 };
		 diag.show();
	}
	//修改
	function edit(eid){
		 
		 var diag = new top.Dialog();
		 diag.Drag=true;
		 diag.Title ="编辑";
		 diag.URL = '<%=basePath%>status/goEdit.do?eid='+eid;
		 diag.Width = 500;
		 diag.Height = 300;
		 diag.CancelEvent = function(){ //关闭事件
			 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
				nextPage(${page.currentPage});
			}
			diag.close();
		 };
		 diag.show();
	}
	//删除
	function del(eid){
		bootbox.confirm("确定要删除该设备吗?", function(result) {
			if(result) {
				var url = '<%=basePath%>status/delete.do?eid='+eid;
				$.get(url,function(data){
					nextPage(${page.currentPage});
				});
			}
		});
	}
	</script>
</html>

